package com.smart.campus.controller;

import com.smart.campus.dto.SysRole;
import com.smart.campus.interfaces.SysRoleServiceApi;
import com.smart.campus.pojo.PagedResponse;
import com.smart.campus.service.SysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class SysRoleController implements SysRoleServiceApi {
    @Autowired
    private SysRoleService sysRoleService;

    /**
     * 列表查询
     * @return
     */
    @Override
    public List<SysRole> findSysRoleList() {
        return sysRoleService.findSysRoleList();
    }

    /**
     * 分页查询条查
     * @param sysRole
     * @param pageNum
     * @param pageSize
     * @return
     */
    @Override
    public PagedResponse<SysRole> pageRole(SysRole sysRole, Integer pageNum, Integer pageSize) {
        return sysRoleService.pageRole(sysRole,pageNum,pageSize);
    }

    /**
     * 新增
     * @param sysRole
     */
    @Override
    public void addRole(SysRole sysRole) {
        sysRoleService.addRole(sysRole);
    }

    /**
     * 删除
     * @param roleId
     */
    @Override
    public void delSysRole(Integer roleId) {
        sysRoleService.delSysRole(roleId);
    }

    /**
     * 回显
     * @param roleId
     * @return
     */
    @Override
    public SysRole findRoleById(Integer roleId) {
        return sysRoleService.findRoleById(roleId);
    }

    /**
     * 修改确定
     * @param sysRole
     */
    @Override
    public void updateRole(SysRole sysRole) {
        sysRoleService.updateRole(sysRole);
    }

    /**
     * 修改状态
     * @param sysRole
     */
    @Override
    public void updateRoleStatus(SysRole sysRole) {
        sysRoleService.updateRoleStatus(sysRole);
    }
}
